<template>
  <div class="gift-ranking">
    <Header />
    <div class="ranking-container">
      <div class="filter-section">
        <button class="time-filter active">本周</button>
        <button class="time-filter">本月</button>
      </div>
      
      <div class="chart-container">
        <!-- 可视化图表区域 -->
      </div>

      <table class="ranking-table">
        <thead>
          <tr>
            <th>排名</th>
            <th>用户</th>
            <th>礼物价值</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody>
          <tr v-for="(item, index) in rankings" :key="index">
            <td>#{{ index + 1 }}</td>
            <td class="user-cell">
              <img :src="item.avatar" class="user-avatar" />
              <span>{{ item.nickname }}</span>
            </td>
            <td>¥{{ item.amount }}</td>
            <td><button class="detail-btn">详情</button></td>
          </tr>
        </tbody>
      </table>

      <div class="pagination">
        <!-- 分页组件 -->
      </div>
    </div>
  </div>
</template>

<script>
import Header from '@/components/Header.vue'
export default {
  components: {
    Header,
  }
}

</script>

<style scoped>
.gift-ranking {
  overflow-y: auto; /* 仅在内容超长时显示纵向滚动 */
}
.title {
  margin: 70px auto;
  font-size: 24px;
  font-weight: bold;
  color: #333;
}

.ranking-container {
  max-width: 800px;
  margin: 60px auto 20px;
  padding: 20px;
  background: rgba(255,255,255,0.9);
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.ranking-table {
  width: 100%;
  margin-top: 20px;
  border-collapse: collapse;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

@media (max-width: 600px) {
  .ranking-container {
    margin: 60px 10px 20px;
    padding: 10px;
  }
  
  .ranking-table th,
  .ranking-table td {
    padding: 8px;
    font-size: 14px;
  }
}
</style>
